package com.jintian.smart.kernel.security.provider;

import com.jintian.smart.base.api.security.entity.LoginFailEntity;
import com.jintian.smart.base.api.security.provider.ISecurityLoginProvider;
import com.jintian.smart.kernel.core.domain.ResponseDTO;
import com.jintian.smart.kernel.core.enumeration.UserTypeEnum;
import com.jintian.smart.kernel.security.service.SecurityLoginService;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;

@DubboService(timeout = 6000)
public class SecurityLoginProvider implements ISecurityLoginProvider {
    @Resource
    private SecurityLoginService securityLoginService;

    /**
     * 检查是否可以登录
     */
    @Override
    public ResponseDTO<LoginFailEntity> checkLogin(Long userId, UserTypeEnum userType) {
        return securityLoginService.checkLogin(userId, userType);
    }

    @Override
    public String recordLoginFail(Long userId, UserTypeEnum userType, String loginName, LoginFailEntity loginFailEntity) {
        return securityLoginService.recordLoginFail(userId, userType, loginName, loginFailEntity);
    }

    @Override
    public void removeLoginFail(Long userId, UserTypeEnum userType) {
        securityLoginService.removeLoginFail(userId, userType);
    }
}
